﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using NngLevelEditor.Utility;

namespace NngLevelEditor.Entities
{
    public class WinTile : Tile
    {
        
        public WinTile()
        {
            Number = 1;
            //LoadContent();
        }

        public WinTile(int number, string type)
            : base(number, type)
        {
        }

        public WinTile(string[] info)
        {
            LoadContent();

            Position = new Microsoft.Xna.Framework.Vector2(float.Parse(info[1]), float.Parse(info[2]));
        }

        public override string GetXml(float minTileX, float minTileY)
        {
            String fileString = "";
            Vector2 xnaPosition = this.Position.ToXnaUnits();
            double tileX = Math.Round((double)(xnaPosition.X / 64) - (double)(minTileX / 64));
            double tileY = Math.Round((double)(xnaPosition.Y / 64) - (double)(minTileY / 64));
            fileString += "<Win>\n";
            fileString += "<X>" + (int)tileX + "</X>\n";
            fileString += "<Y>" + (int)tileY + "</Y>\n";
            fileString += "<Type>" + this.Type + "</Type>\n";
            fileString += "<Number>" + this.Number + "</Number>\n";
            fileString += "</Win>\n";

            return fileString;
        }

    }
}
